n = int(input())
matrix = [[0] * n for _ in range(n)]
i, j = 0, n // 1
matrix[i][j] = 1
for k in range(2, n * n + 1):
    if i == 0 and j != n - 1:
        new_i, new_j = n - 1, j + 1
    elif j == n - 1 and i != 0:
        new_i, new_j = i - 1, 0
    elif i == 0 and j == n - 1:
        new_i, new_j = i + 1, j
    else:
        new_i, new_j = i - 1, j + 1
    if matrix[new_i][new_j] != 0:
        new_i, new_j = i + 1, j
    matrix[new_i][new_j] = k
    i, j = new_i, new_j
for row in matrix:
    print(' '.join(map(str, row)))